package com.medusa.aps.business.modules.security.mp.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.medusa.aps.business.model.pagination.Page;
import com.medusa.aps.business.modules.security.model.input.UserRoleQueryPara;
import com.medusa.aps.business.modules.security.mp.entity.Role;
import com.medusa.aps.business.modules.security.mp.entity.UserRole;
import org.apache.ibatis.annotations.Param;

import java.util.List;


/**
 * @author: xianhui.yu
 **/
public interface UserRoleMapper extends BaseMapper<UserRole> {

    /**
     * 列表分页
     *
     * @param page
     * @param filter
     * @return
     */
    List<UserRole> selectUserRoles(Page page, @Param("filter") UserRoleQueryPara filter);

    /**
     * 列表
     *
     * @param filter
     * @return
     */
    List<UserRole> selectUserRoles(@Param("filter") UserRoleQueryPara filter);

    /**
     * 根据角色Id删除用户与角色相关联数据
     *
     * @param roleId:
     * @return: void
     */
    void deleteByRoleId(@Param("roleId") Integer roleId);

    /**
     * 根据用户Id查询关联角色
     *
     * @param userId:
     */
    List<Role> selectRoleByUserId(@Param("userId") Long userId);

}
